package top.buyibuyi.course.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import top.buyibuyi.course.R;
import top.buyibuyi.course.pojo.Classroom;
import top.buyibuyi.course.service.UpdateClassroomService;

@RestController
@CrossOrigin
@RequestMapping("/course")
public class UpdateClassroomController {
    @Autowired
    private UpdateClassroomService updateClassroomService;

    @PostMapping("/updateState")
    public R updateState(@RequestBody Classroom classroom){
        System.out.println("教室》》》》》"+classroom);
        try {
            Boolean aBoolean = updateClassroomService.updateState(classroom);
            return R.ok().data("data",aBoolean);
        }catch (Exception e){
            e.printStackTrace();
            return R.error();
        }
    }
}
